function selector(selected_img_path,  unselected_img_path, current) {
   // var selected_img = "resources/images/home-page-page/selected.png";
   // var unselected_img = "resources/images/home-page-page/unselected.png"
    var selected_img = selected_img_path;
    var unselected_img = unselected_img_path;
    var currentSelectedId = current;
    $(".template_select .template").each(function (index, element) {
        $(this).click(function () {
            var tmp_id = $(this).attr("id");
            currentSelectedId = tmp_id;
            setSelected(tmp_id, selected_img, unselected_img);
        });

    });

    $("#apply").click(function(){
            $("#template-id").val(currentSelectedId);
    });
}

function setSelected(tmp_id, selectedImg, unselectedImg){
    $(".template_select .template").each(function (i) {
        var id = $(this).attr("id");
        var background = $(this).find(".background");
        if(id === tmp_id)
            $(background).attr("src", selectedImg);
        else
            $(background).attr("src", unselectedImg);
    });
}